package fractal.app;

/** Class settings initiation */
public final class AppInit {

	/** configuration application */
	private AppConfig appConfig;

	/** constructor */
	public AppInit() {
		this.initConfig();
		this.loadConfig();
	}

	/** initiation AppConfig */
	private void initConfig() {
		this.appConfig = AppConfig.getInstance();
	}

	/** load configuration */
	public void loadConfig() {
		if (!this.appConfig.load()) {
			this.appConfig.set(AppDefine.STARTNEW, AppDefine.STARTNEW);
			this.appConfig.set(AppDefine.APPSKIN, AppDefine.SKINDEF);

			this.appConfig.set(AppDefine.APPSIZE, "medium");
			this.appConfig.set(AppDefine.APPWIDTH, "800");
			this.appConfig.set(AppDefine.APPHEIGHT, "600");
		}
	}

	/** save configuration */
	public void saveConfig(String key, String val) {
		this.appConfig.set(key, val);
		this.appConfig.save();
	}
}
